package com.urms.controller.roleMenu;

import com.urms.service.RoleMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

@RestController
@RequestMapping("/roleMenu")
public class RoleMenuController {

    @Autowired
    private RoleMenuService roleMenuService;


    @PostMapping("/insertRoleMenu")
    public Integer insertRoleMenu(Integer roleId,Integer[]menuIds){
        return roleMenuService.insertRoleMenu(roleId, menuIds);
    }

    @GetMapping("/selectRoleMenuByRoleId")
    public List<Integer> selectRoleMenuByRoleId(Integer roleId){
        return roleMenuService.selectByRoleId(roleId);
    }

    @GetMapping("/selectMenuByUserLoginName")
    public  List<String> selectMenuByUserLoginName(String user){
        return roleMenuService.selectMenuByUserLoginName(user);
    }
}
